<?php
	$gp1 = new stdClass;
	$gp1->no_of_day = isset($student_attendance) && isset($student_attendance['gp1']) ? $student_attendance['gp1']->no_of_days : 0;
	$gp1->absent = isset($student_attendance) && isset($student_attendance['gp1']) ? $student_attendance['gp1']->absent : 0;
	$gp1->present = isset($student_attendance) && isset($student_attendance['gp1']) ? $student_attendance['gp1']->present : 0;
	$gp1->tardy = isset($student_attendance) && isset($student_attendance['gp1']) ? $student_attendance['gp1']->tardy : 0;

	$gp2 = new stdClass;
	$gp2->no_of_day = isset($student_attendance) && isset($student_attendance['gp2']) ? $student_attendance['gp2']->no_of_days : 0;
	$gp2->absent = isset($student_attendance) && isset($student_attendance['gp2']) ? $student_attendance['gp2']->absent : 0;
	$gp2->present = isset($student_attendance) && isset($student_attendance['gp2']) ? $student_attendance['gp2']->present : 0;
	$gp2->tardy = isset($student_attendance) && isset($student_attendance['gp2']) ? $student_attendance['gp2']->tardy : 0;

	$gp3 = new stdClass;
	$gp3->no_of_day = isset($student_attendance) && isset($student_attendance['gp3']) ? $student_attendance['gp3']->no_of_days : 0;
	$gp3->absent = isset($student_attendance) && isset($student_attendance['gp3']) ? $student_attendance['gp3']->absent : 0;
	$gp3->present = isset($student_attendance) && isset($student_attendance['gp3']) ? $student_attendance['gp3']->present : 0;
	$gp3->tardy = isset($student_attendance) && isset($student_attendance['gp3']) ? $student_attendance['gp3']->tardy : 0;

	$gp4 = new stdClass;
	$gp4->no_of_day = isset($student_attendance) && isset($student_attendance['gp4']) ? $student_attendance['gp4']->no_of_days : 0;
	$gp4->absent = isset($student_attendance) && isset($student_attendance['gp4']) ? $student_attendance['gp4']->absent : 0;
	$gp4->present = isset($student_attendance) && isset($student_attendance['gp4']) ? $student_attendance['gp4']->present : 0;
	$gp4->tardy = isset($student_attendance) && isset($student_attendance['gp4']) ? $student_attendance['gp4']->tardy : 0;

	$gp5 = new stdClass;
	$gp5->no_of_day = floatval($gp1->no_of_day) + floatval($gp2->no_of_day) + floatval($gp3->no_of_day) + floatval($gp4->no_of_day);
	$gp5->absent = floatval($gp1->absent) + floatval($gp2->absent) + floatval($gp3->absent) + floatval($gp4->absent);
	$gp5->present = floatval($gp1->present) + floatval($gp2->present) + floatval($gp3->present) + floatval($gp4->present);
	$gp5->tardy = floatval($gp1->tardy) + floatval($gp2->tardy) + floatval($gp3->tardy) + floatval($gp4->tardy);
?>
<table class="table table-bordered table-stripped">
	<tr class="info">
		<td>Term Attendance</td>
		<td style="text-align:center;">1</td>
		<td style="text-align:center;">2</td>
		<td style="text-align:center;">3</td>
		<td style="text-align:center;">4</td>
		<td style="text-align:center;">Total</td>
	</tr>
	<tr>
		<td>Total no. of Days</td>
		
		<td style="text-align:right;"><span class='badge'><?=$gp1->no_of_day?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp2->no_of_day?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp3->no_of_day?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp4->no_of_day?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp5->no_of_day?></span></td>
	</tr>
	<tr>
		<td>Absent</td>
		<td style="text-align:right;"><span class='badge badge-important'><?=$gp1->absent?></span></td>
		<td style="text-align:right;"><span class='badge badge-important'><?=$gp2->absent?></span></td>
		<td style="text-align:right;"><span class='badge badge-important'><?=$gp3->absent?></span></td>
		<td style="text-align:right;"><span class='badge badge-important'><?=$gp4->absent?></span></td>
		<td style="text-align:right;"><span class='badge badge-important'><?=$gp5->absent?></span></td>
	</tr>
	<tr>
		<td>Present</td>
		<td style="text-align:right;"><span class='badge'><?=$gp1->present?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp2->present?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp3->present?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp4->present?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp5->present?></span></td>
	</tr>
	<tr>
		<td>Tardy</td>
		<td style="text-align:right;"><span class='badge'><?=$gp1->tardy?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp2->tardy?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp3->tardy?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp4->tardy?></span></td>
		<td style="text-align:right;"><span class='badge'><?=$gp5->tardy?></span></td>
	</tr>
</table>